package com.blog.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.blog.system.domain.User;
import com.blog.system.mapper.UserMapper;
import com.blog.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
* @author W10LL
* @description 针对表【user(用户表)】的数据库操作Service实现
* @createDate 2025-04-03 15:54:45
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
    implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public boolean existsByUsername(String username) {
        User user = userMapper.selectByUsername(username);
        return user == null;
    }

    @Override
    public boolean existsByPhone(String phone) {
        User user = userMapper.selectByPhone(phone);
        return user == null;
    }

    @Override
    public void insertUser(User user) {
        userMapper.insert(user);
    }

    @Override
    public User getUserByUsername(String username) {
        return userMapper.selectByUsername(username);

    }
}




